<template>

  <div>
    <van-nav-bar
      :title="$route.meta.title"
      fixed
      left-arrow
     @click-left="$router.go(-1)"
     @click-right="$router.push({name:'msearch'})"
    >
     <!-- <router-link to='/mobile/search' > -->
        <van-icon
          v-if="$route.name!=='msearch'"
          name="search"
          slot="right"
         
        />
      <!-- </router-link>  -->
    </van-nav-bar>

    <!-- 占坑 -->
    <router-view class="mobile_content"></router-view>

    <van-tabbar v-show='isShowBar' v-model="active">
      <van-tabbar-item
        icon="home-o"
        to="index"
      >首页</van-tabbar-item>
      <van-tabbar-item
        icon="orders-o"
       
        to="category"
      >分类</van-tabbar-item>
      <van-tabbar-item
        icon="cart-o"
        
        to="cart"
      >购物车</van-tabbar-item>
      <van-tabbar-item
        icon="user-o"
        
        to="user"
      >会员中心</van-tabbar-item>
    </van-tabbar>
  </div>

</template>

<script>
export default {
  data () {
    return {
      // swe:[],
      active: 0 ,
      routeMap : [
      'mIndex',
      'mcategory',
      'mcart',
      'muser',
      'msearch'
    ]
    }
  },
  computed: {
    isShowBar () {
      return this.routeMap.includes(this.$route.name)
    }
  },
  created () {
    this.active = this.routeMap.indexOf(this.$route.name)
  }
}
</script>

<style>

.nav-barr{
  background-color: #006699;
  color: #000;
}
</style>
